CC             := gcc
CCLD           := ${CC}
LDFLAGS        :=

TARGET=libxt_wx.so
DEST=/home/kendo/ipwall/rootfs
DESTDIR = $(DEST)/lib/xtables
TEST_DESTDIR = $(DEST)/lib/xtables
XTABLES_SRCDIR = /home/kendo/ipwall/sysapps/iptables-1.4.14

# Add your debugging flag (or not) to CFLAGS
DEBFLAGS = -O


EXTRA_CFLAGS := $(DEBFLAGS)
EXTRA_CFLAGS := -I$(srcdir)/include

regular_CFLAGS := -D__EXPORTED_HEADERS__ -D_LARGEFILE_SOURCE=1 -D_LARGE_FILES -D_FILE_OFFSET_BITS=64 -D_REENTRANT -Wall -Wmissing-declarations -Wmissing-prototypes -Wredundant-decls -Wshadow -Wstrict-prototypes -Winline -pipe -DXTABLES_LIBDIR=\"${xtlibdir}\" -DXTABLES_INTERNAL

AM_CFLAGS      := ${regular_CFLAGS} -I${XTABLES_SRCDIR}/include
AM_DEPFLAGS     = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@

${TARGET}: libxt_wx.c
	${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} ${AM_CFLAGS} -D_INIT=lib$*_init -DPIC -fPIC -shared ${LDFLAGS} -o ${TARGET} libxt_wx.c;

install: ${TARGET}
	rm -rf ${DESTDIR}/${TARGET}
	cp ${TARGET} ${DESTDIR}
uninstall:
	rm -rf ${DESTDIR}/${TARGET}

test: ${TARGET}
	rm -rf ${TEST_DESTDIR}/${TARGET}
	cp ${TARGET} ${TEST_DESTDIR}
clean:
	rm -rf *.o *.ko .tmp* .*.cmd *.mod.c *.symvers modules.order *.oo *.so .*.d
